package cn.bugstack.springframework.aop;

import cn.bugstack.springframework.util.ClassUtils;

/**
 * 被代理的目标对象
 */
public class TargetSource {

    private final Object target;

    public TargetSource(Object target) {
        this.target = target;
    }

    /**
     * 判断Cglib对象
     * @return
     */
    public Class<?>[] getTargetClass(){
//        return this.target.getClass().getInterfaces();
        Class<?> calzz = this.target.getClass();
        calzz = ClassUtils.isCglibProxyClass(calzz) ? calzz.getSuperclass():calzz;
        return calzz.getInterfaces();
    }



    public Object getTarget(){
        return this.target;
    }
    
}
